// CopyRight (c) 2011
// All rights reserved.

/********************************************************************
	filename:	safe_list.h
	created:	04/30/2011
	author:		Tsubasa
	purpose:	thread-safe list

********************************************************************/

#ifndef _H_SAFE_LIST
#define _H_SAFE_LIST

#include <windows.h>

namespace XEngine
{

template<typename type>
class SafeList
{
public:
	SafeList()
	{
		InitializeSListHead(&container_);
	}

	type	Pop()
	{
		return (type)InterlockedPopEntrySList(&container_);
	}

	void	Push(type node)
	{
		InterlockedPushEntrySList(&container_, node);
	}
	
private:
	SLIST_HEADER	container_;
};


}

#endif
